﻿Public Class frmPrincipal

    Private Sub mExportacion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mVentas.Click
        Dim frmLibroventas As New frmLibroVentas
        frmLibroventas.MdiParent = Me
        frmLibroventas.Show()
    End Sub

    Private Sub mLibroCompras_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mLibroCompras.Click
        Dim frmLibroCompras As New frmLibro
        frmLibroCompras.MdiParent = Me
        frmLibroCompras.Show()
    End Sub


    Private Sub frmPrincipal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        statusFechaHora.Text = Date.Today.ToString("dd \de MMMM \de yyyy")

        Dim imagepath As String = "E:\fondo.jpg"
        Dim fs As System.IO.FileStream
        'MDI Form image background layout change here
        '(Remember control imagebakground layout take default form background layount )
        Me.BackgroundImageLayout = ImageLayout.Zoom
        'Checking File exists if yes go --->
        If System.IO.File.Exists(imagepath) Then
            'Read Image file
            fs = System.IO.File.OpenRead(imagepath)
            fs.Position = 0
            'Change MDI From back ground picture
            For Each ctl As Control In Me.Controls
                If (TypeOf ctl Is MdiClient) Then
                    ctl.BackColor = Color.White
                    ctl.BackgroundImage = System.Drawing.Image.FromStream(fs)
                    Exit For
                End If
            Next
        End If
    End Sub


    Private Sub mSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mSalir.Click
        Application.Exit()
    End Sub

    Private Sub ContabilidadEnHojasSueltasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContabilidadEnHojasSueltasToolStripMenuItem.Click
        Dim frmVisor As New frmVisor
        frmVisor.MdiParent = Me
        frmVisor.Show()
    End Sub

    Private Sub mLDEC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mLDEC.Click
        Dim frmLibroDiarioExistencias As New frmLDEC
        frmLibroDiarioExistencias.MdiParent = Me
        frmLibroDiarioExistencias.Show()
    End Sub

    Private Sub InformeDeChequesNoCobradosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InformeDeChequesNoCobradosToolStripMenuItem.Click
        Dim infCheques As New Form_Principal
        infCheques.MdiParent = Me
        infCheques.Show()
    End Sub
End Class